#define _CRT_SECURE_NO_WARNINGS
#include"string.h"
namespace bit
{
	void test_string1()
	{
		string s1;
		string s2("hello world");
		string s3(s2);
		string s4 = s3;

		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;
		cout << s3.c_str() << endl;
		cout << s4.c_str() << endl;
	}
	void test_string2()
	{
		string s1("hello world");
		s1.push_back('c');
		cout << s1.c_str() << endl;
		s1 += 'd';
		cout << s1.c_str() << endl;
		s1.append("lalalalala");
		cout << s1.c_str() << endl;
		s1 += "qqqqq";
		cout << s1.c_str() << endl;
	}
	void test_string3()
	{
		string s1("hello world");
		string s2;
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		swap(s1, s2);
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		s2.resize(5);
		string::iterator it = s2.begin();
		while (it != s2.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
		cout << s2.size() << endl;

		s2.resize(20, 'a');
		for (auto e : s2)
		{
			cout << e << " ";
		}
		cout << endl;
		cout << s2.size() << endl;
	}
	void test_string4()
	{
		string s1("hello world");
		cout << s1.find('h') << endl;
		cout << s1.find('o') << endl;
		cout << s1.find('d') << endl;

		s1.insert(5, '6');
		cout << s1.c_str() << endl;
		s1.insert(5, "123456");
		cout << s1.c_str() << endl;
		s1.erase(5, 7);
		cout << s1.c_str() << endl;
	}
}
void test_string5()
{
	string s1("hello world");
	cout << s1 << endl;

	cin >> s1;
	cout << s1 << endl;

}
int main()
{
	//bit::test_string1();
	//bit::test_string2();
	//bit::test_string3();
	//bit::test_string4();
	test_string5();
	return 0;
}